package com.ruoyi.group.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.group.domain.Qualitied;
import com.ruoyi.group.domain.dto.QualitiedDealDto;
import com.ruoyi.group.service.QualitiedService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: CHL  <br/>
 * @ToDo: 质检表
 * Date: 2022/3/14:10:07  <br/>
 * Description:
 */
@Api(value = "/qualitied",description = "质检表的")
@RestController
@RequestMapping("/qualitied")
public class QualitiedController extends BaseController {
    @Autowired
    QualitiedService qualitiedService;
    @ApiOperation(value = "/qualitied/add",httpMethod = "POST",response = AjaxResult.class)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody Qualitied qualitied){
        return toAjax(qualitiedService.add(qualitied));
    }

    @ApiOperation(value = "/qualitied/findByOrderId/{orderId}",httpMethod = "GET",response = AjaxResult.class)
    @GetMapping("/findByOrderId/{orderId}")
    public AjaxResult findByOrderId(@PathVariable int orderId){
        return AjaxResult.success(qualitiedService.findByOrderId(orderId));
    }
    //提价对某一个工单的质检
    @ApiOperation(value = "/qualitied/submit",httpMethod = "POST",response = AjaxResult.class)
    @PostMapping("/submit")
    public AjaxResult qualitiedByOrderId(@RequestBody QualitiedDealDto qualitiedDealDto){

        return AjaxResult.success(qualitiedService.qualitiedByOrderId(qualitiedDealDto));
    }
}
